package io.awen.modules.sign.controller;

import io.awen.common.utils.PageUtils;
import io.awen.common.utils.R;
import io.awen.modules.sign.entity.SignCarEntity;
import io.awen.modules.sign.qo.SignCarModel;
import io.awen.modules.sign.qo.SignCarQo;
import io.awen.modules.sign.qo.SignContainerQo;
import io.awen.modules.sign.service.SignCarService;
import io.awen.modules.sign.service.SignContainerService;
import io.awen.modules.sign.service.SignTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.List;
import java.util.Map;


/**
 * 收运单位车辆信息表
 *
 * @author liu.wen
 * @email liu.wen@qq.com
 * @date 2022-08-10 00:47:08
 */
@RestController
@RequestMapping("sign/report")
public class SignReportController {
    @Autowired
    private SignTaskService signTaskService;

    @Autowired
    private SignContainerService signContainerService;

    /**
     * 查询集水池总量、日均拉运量、月均拉运粮、拉运总量
     */
    @PostMapping("/getSummaryReport")
    public R getSummaryReport(HttpServletRequest request){

        SignContainerQo qo = new SignContainerQo();
        int total = signContainerService.total(qo);






        return R.ok().put("data", "");
    }


    /**
     * 每天收运量、日期和收运量列表
     */
    @PostMapping("/getDailyTotalReport") //sign/report/getDailyTotalReport
    public R getDailyTotalReport(HttpServletRequest request){

        String startTime = request.getParameter("startTime");
        String endTime = request.getParameter("endTime");

        List<Map<String, Object>> list = signTaskService.getDailyTotalReport(startTime, endTime);

        return R.ok().put("data", list);
    }


    @PostMapping("/getTotalByCar") //sign/report/getTotalByCar
    public R getTotalByCar(HttpServletRequest request){

        String startTime = request.getParameter("startTime");
        String endTime = request.getParameter("endTime");

        List<Map<String, Object>> list = signTaskService.getTotalByCar(startTime, endTime);
        return R.ok().put("data", list);
    }

}
